<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<meta content="" name="description" />
    <meta content="webthemez" name="author" />
    <title>FAS</title>
    <!-- Bootstrap Styles-->
    <link href="assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="assets/css/font-awesome.css" rel="stylesheet" />
 
    <!-- Custom Styles-->
    <link href="assets/css/custom-styles.css" rel="stylesheet" />
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link rel="stylesheet" href="assets/js/Lightweight-Chart/cssCharts.css"> 
	<!--引入layui-->
	<!-- jQuery Js -->
    <script src="assets/js/jquery-1.10.2.js"></script>
	<script src="js/layui/layui.js"></script>
</head>

<body style="overflow:scroll;margin:0; padding:0;">
    <div id="wrapper">
        <nav class="navbar navbar-default top-navbar" role="navigation">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="index.jsp"><strong><i class="icon fa fa-plane"></i> FAS</strong></a>
				
		<div id="sideNav" href="">
		<i class="fa fa-bars icon"></i> 
		</div>
            </div>

            <ul class="nav navbar-top-links navbar-right">
            	<li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#" aria-expanded="false">
                        <i class="fa fa-user fa-fw"></i> <i class="fa fa-caret-down"></i>
                    </a>
              
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i>系统设置</a>
                        	<ul style="list-style:none;">
                        		<c:forEach items="${fus }" var="fus">
                        			<li id="userInfo${fus.functionId }"><a href="javascript:void(0)" style="text-decoration: none;color: black"><i class="fa fa-gear fa-fw"></i>${fus.functionName }</a></li>
                        		</c:forEach>
                        		<!-- <li id="powerSet"><a href="javascript:void(0)" style="text-decoration: none;color: black;"><i class="fa fa-gear fa-fw"></i>权限设置</a></li>
								<li id="deptSet"><a href="javascript:void(0)" style="text-decoration: none;color: black;"><i class="fa fa-gear fa-fw"></i>数据设置</a></li> -->
                        	</ul>
                        </li>
                        <li class="divider"></li>
                        <li><a href="${pageContext.request.contextPath}/exit.do"><i class="fa fa-sign-out fa-fw"></i> 退出</a>
                        </li>
                    </ul>
                    <!-- /.系统设置 -->
                </li>
               
               
            </ul>
        </nav>
        
        <!--/. 菜单栏  -->
        <nav class="navbar-default navbar-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="main-menu">
                    <%-- <li>
                        <a href="chart"><i class="fa fa-table"></i >数据管理<span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                           
                            <li>
                                <a href="javascript:void(0)">个人工作信息<span class="fa arrow"></span></a>
                                <ul class="nav nav-third-level">
                                    <li>
                                        <a href="${pageContext.request.contextPath}/work/myWork.do" target="center">我的待办(0)</a>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/read/myReading.do" target="center">我的待阅(0)</a>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/work/myWorkDone.do" target="center">我的已办(0)</a>
                                    </li>
 									<li>
                                        <a href="${pageContext.request.contextPath}/read/myRead.do" target="center">我的已阅(0)</a>
                                    </li>
                                </ul>

                            </li>
                            
                            <li>
                                <a href="javascript:void(0)">个人数据<span class="fa arrow"></span></a>
                                <ul class="nav nav-third-level">
                                    <li>
                                        <a href="${pageContext.request.contextPath}/echats/choose.do" target="center">个人专项总览</a>
                                    </li>
                                    <li>
                                        <a href="${pageContext.request.contextPath}/echats/chooseAccount.do" target="center">个人报销总览</a>
                                    </li>
                                    <li>
                                        <a href="datamanager/persondata/personalMap.html" target="center">个人差旅地图</a>
                                    </li>

                                </ul>

                            </li>
                            
                        </ul>
                    </li>
                    
                    <li>
                        <a href="javascript:void(0)"><i class="fa fa-sitemap"></i> 报账平台<span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li>
                                <a href="javascript:void(0)" target="center" id="submitApply">申请报账</a>
                            </li>
                            <li>
                                <a href="${pageContext.request.contextPath}/declarationInformation/listSingMsgByStaff.do" target="center">申报信息</a>
                            </li>
							</ul>
						</li> --%>	
                    <c:forEach items="${functions }" var="functions">
                    	<li>
                    		<a href="javascript:void(0)" name="${functions.functionId }" onclick="myClick(this)" value="0"><i class="fa fa-sitemap"></i>${functions.functionName }<span class="fa arrow"></span></a>
                    	</li>	
                    </c:forEach>
                </ul>
            </div>
        </nav>
        <!-- /. 菜单栏  -->
      
      <!--右边部分-->
		<div id="page-wrapper">
			<!--
            	作者：1049794100@qq.com
            	时间：2018-01-04
            	描述：这是框架
            -->
            
			<iframe name="center"   scrolling="no" rameborder="0"   width="100%" id="iframepage" height="900px" >
               
            </iframe>
            <script type="text/javascript">
               		$(document).ready(function(){
               			console.log($("iframe[name='center']").attr("name"));
               			console.log($("iframe[name='center']").attr("height"));
               			$("iframe[name='center']").attr("src","${pageContext.request.contextPath}/work/myWork.do?url=datamanager/personwork/myWork");
               			console.log($("iframe[name='center']").attr("src"));
               		});
               </script>
           <!-- <div id="page-inner">
				
            </div>-->
            <!-- /. 这是框架  -->
        </div>
        <!-- /. 右边部分  -->
    </div>
    <!-- /. WRAPPER  -->
    <!-- JS Scripts-->
    
    <!-- Bootstrap Js -->
    <script src="assets/js/bootstrap.min.js"></script>
	<!-- <script src="js/system.js"></script> -->

    <!-- Metis Menu Js -->
    <script src="assets/js/jquery.metisMenu.js"></script>

	
	 
	<script src="assets/js/easypiechart.js"></script>
	<script src="assets/js/easypiechart-data.js"></script>
	
	 <script src="assets/js/Lightweight-Chart/jquery.chart.js"></script>
	
    <!-- Custom Js -->
    <script src="assets/js/custom-scripts.js"></script>

      
    <!-- Chart Js -->
    <script type="text/javascript" src="assets/js/chart.min.js"></script>  
    <script type="text/javascript" src="assets/js/chartjs.js"></script> 
    
    <!-- 权限菜单ajax -->
	
	<script type="text/javascript">
		function myClick(objThis){
			var value = $(objThis).attr("value");//标志符
			var functionId = $(objThis).attr("name");//菜单id
			if(value == 0){
				$(objThis).attr("value","1");
				$.ajax({
					url:"${pageContext.request.contextPath}/getFunctionAjax.do",
					type:"post",
					dataType:"json",
					data:{"parent":functionId},
					success:function(data){
						console.log(data.functions);
						var str = '';
						if(functionId == 9011 || functionId == 9001){//第一级菜单请求
							str ='<ul class="nav nav-second-level">';
						}
						if(functionId == 9002 || functionId == 9007){//个人工作信息&&个人数据
							str = '<ul class="nav nav-third-level">';
						}
		            	$.each(data.functions,function(key,val){
		            			if(val.parent == 9001){//跟目录--第一个目录
		            				str += '<li><a href="javascript:void(0)" onclick="myClick(this)" name="'+val.functionId+'" value="0"><i class="fa fa-table"></i >'+val.functionName+'<span class="fa arrow"></span></a></li>';
		            			}
		            			if(9011 == val.parent){
		            				if(9012 == val.functionId ){
		            					str += '<li><a href="javascript:void(0)" target="center" onclick="submitapply()">'+val.functionName+'</a></li>';
		            				}
		            				if(9013 == val.functionId ){
		            					str += '<li><a href="'+val.functionUrl+'" target="center">'+val.functionName+'</a></li>';	
		            				}
		            			}
		            			if(val.parent == 9002 || val.parent == 9007){
		            				str += '<li><a href="'+val.functionUrl+'" target="center">'+val.functionName+'</a></li>';
		            			}
		            	});
		            	str += "</ul>";
		            	$(objThis).after(str);
					},
					error:function(data){
						console.log(data);
					}
				});
			}else {
				console.log("lala");
				$(objThis).next().toggle();
			}
		};
	</script>
	
	<script>
	layui.use('layer', function(){
  			var layer = layui.layer;
  		});  
		function submitapply(){
    		layer.open({
	     		type: 2,
	      		title: '',
	      		maxmin: true,
	      		shadeClose: false, //点击遮罩关闭层
	      		area : ['90%' , '90%'],
	      		content: ['${pageContext.request.contextPath}/chooseApplication/chooseType.do','yes']
    		});
  		};

 
		//页面加载时，加载系统设置的菜单
		 window.onload = function(){
		 	power();//权限设置主菜单函数
		    userInfo1();//个人信息主菜单函数（管理员）
		 	userInfo2();//个人信息主菜单函数（普通用户）
		 	userInfo3();//个人信息主菜单函数（普通用户）
		 	deptLevel();//部门职称费用主菜单函数（管理员）
		 	
		 }

		 function userInfo1(){
		 	//用户信息弹出框(管理员)
		 	layui.use('layer', function(){
		   			var layer = layui.layer;
		   		});  
		 		 $('#userInfo9018').on('click', function(){
		     	layer.open({
		      		 type: 2,
		       		title: '个人信息',
		       		maxmin: true,
		       		shadeClose: false, //点击遮罩关闭层
		       		area : ['90%' , '80%'],
		       		content: ['${pageContext.request.contextPath}/user/getUserMsg.do','yes']
		     });
		   });
		 }
		 function power(){
		 	//权限弹出框
		 	layui.use('layer', function(){
		   			var layer = layui.layer;
		   		});  
		 		 $('#userInfo9016').on('click', function(){
		     	layer.open({
		      		 type: 2,
		       		title: '权限设置',
		       		maxmin: true,
		       		shadeClose: false, //点击遮罩关闭层
		       		area : ['60%' , '80%'],
		       		content: ['${pageContext.request.contextPath}/power/listUserSketchyMsg.do','yes']
		     });
		   });
		 }

		 function userInfo2(){
		 	//用户信息弹出框(个人)
		 	layui.use('layer', function(){
		   			var layer = layui.layer;
		   		});  
		 		 $('#userInfo9015').on('click', function(){
		     	layer.open({
		      		 type: 2,
		       		title: '个人信息',
		       		maxmin: true,
		       		shadeClose: false, //点击遮罩关闭层
		       		area : ['50%' , '60%'],
		       		content: ['${pageContext.request.contextPath}/user/getInformationByOrdinary.do','yes']
		     });
		   });
		 }
		 function userInfo3(){
			 	//权限设置
			 	layui.use('layer', function(){
			   			var layer = layui.layer;
			   		});  
			 		 $('#userInfo9019').on('click', function(){
			     	layer.open({
			      		 type: 2,
			       		title: '权限设置',
			       		maxmin: true,
			       		shadeClose: false, //点击遮罩关闭层
			       		area : ['50%' , '60%'],
			       		content: ['${pageContext.request.contextPath}/getUserRoleList.do','yes']
			     });
			   });
			 }

		 function deptLevel(){
		 	//用户信息弹出框(部门职称设置)
		 	layui.use('layer', function(){
		 		var layer = layui.layer;
		 	});
		 	$('#userInfo9017').on('click', function(){
		 		layer.open({
		 			type: 2,
		 			title: '数据设置',
		 			maxmin: true,
		 			shadeClose: false, //点击遮罩关闭层
		 			area : ['50%' , '60%'],
		 			content: ['${pageContext.request.contextPath}/DeptLevel/getDepartmentName.do','yes']
		 		});
		 	});
		 }
		 
		 
	</script>
</body>

</html>
